home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / telecom / 146 / gfa / xref.lst < prev    next >
Encoding:
File List  |  1987-06-16  |  4.0 KB  |  176 lines

  1. '
  2. ' I think the GEnie handle of the author of this program is NTACTONE,
  3. ' whomever that is.... I've taken it and added alerts and status lines
  4. ' to let you know what's going on... Also added a printer check, and better
  5. ' file handling (selector boxex, etc) and a restart ability.  Enjoy!
  6. '
  7. ' Wm. A. Van Nest, Sr., President, VanGuard Datasystems
  8. ' BBS # 301-577-3659 (MichTron BBS of course, 300/1200/2400 baud)
  9. '
  10. Cls
  11. Dim A$(10000),Label(1000),Label$(1000),Procs(1000),Procs$(1000),Funcs(1000),Funcs$(1000)
  12. Beginning:
  13. Close
  14. Cls
  15. Print "          Select the program name... It MUST be a .LST ('Save,A') file!"
  16. Fileselect "\*.LST","",Inp$
  17. If Inp$="" Or Right$(Inp$,1)="\"
  18.   Goto Leave
  19. Endif
  20. Cls
  21. Open "I",#1,Inp$
  22. Print At(1,10);"Reading line:";
  23. Repeat
  24.   Print At(50,10);X%;
  25.   Line Input #1,A$(X%)
  26.   Inc X%
  27. Until Eof(#1)
  28. Numlines%=X%-1
  29. Cls
  30. Print At(1,10);"Working on line:";
  31. For X=1 To Numlines%
  32.   Print At(50,10);X;
  33.   Flg=0
  34.   Gosub Find_proc
  35.   Gosub Find_label
  36.   Gosub Find_funcs
  37. Next X
  38. Cls
  39. Testprint:
  40. If Not (Gemdos(&H11))
  41.   Alert 1,"Printer not ready!",1,"Retry|Abort",Button
  42.   If Button=1
  43.     Goto Testprint
  44.   Else
  45.     Goto Leave
  46.   Endif
  47. Endif
  48. Gosub Prlabs
  49. Gosub Prprocs
  50. Gosub Prfuncs
  51. Alert 2,"Do you want to print|the entire program?",1,"Yes|No",Button
  52. If Button=1
  53.   Gosub Listpgm
  54. Endif
  55. Leave:
  56. Alert 2,"Do another?",1,"Yes|No",Button
  57. If Button=1
  58.   Goto Beginning
  59. Endif
  60. System
  61. Procedure Find_proc
  62.   If Instr(A$(X),"Procedure")
  63.     Aa=Instr(A$(X),Chr$(34))
  64.     If Aa
  65.       Goto Nogo
  66.     Else
  67.       Cnt=11
  68.       Gosub Procnmebld
  69.       Procs(Proccnt)=X
  70.       Procs$(Proccnt)=Procname$
  71.       Inc Proccnt
  72.     Endif
  73.     Nogo:
  74.   Endif
  75. Return
  76. Procedure Find_funcs
  77.   If Instr(A$(X),"Deffn")
  78.     Aa=Instr(A$(X),Chr$(34))
  79.     If Aa
  80.       Goto Nogo1
  81.     Else
  82.       Cnt=6
  83.       Gosub Procnmebld
  84.       Funcs(Funcscnt)=X
  85.       Funcs$(Funcscnt)=Procname$
  86.       Inc Funcscnt
  87.     Endif
  88.     Nogo1:
  89.   Endif
  90. Return
  91. Procedure Find_label
  92.   Flg=0
  93.   B=Instr(A$(X),":")
  94.   If B Then
  95.     C=Instr(A$(X),Chr$(34))
  96.     If C>0 And C<B Then
  97.       Goto Nogoa
  98.     Else
  99.       Label(Labcnt)=X
  100.       Gosub Unspace
  101.       Label$(Labcnt)=A$(X)
  102.       Inc Labcnt
  103.     Endif
  104.     Nogoa:
  105.   Endif
  106. Return
  107. Procedure Unspace
  108.   Void Fre(0)
  109.   For Unsp=1 To Len(A$(X))
  110.     Exit If Mid$(A$(X),Unsp,1)<>" "
  111.   Next Unsp
  112.   A$(X)=Mid$(A$(X),Unsp)
  113. Return
  114. Procedure Procnmebld
  115.   For Temp=11 To Len(A$(X))
  116.     T$=Mid$(A$(X),Temp,1)
  117.     Exit If T$="("
  118.     Exit If T$=" "
  119.   Next Temp
  120.   Procname$=Mid$(A$(X),Cnt,Temp-Cnt)
  121. Return
  122. Procedure Prlabs
  123.   If Labcnt
  124.     Cls
  125.     Print At(1,10);"Printing Labels...";
  126.     Lprint
  127.     Lprint "**********************************************"
  128.     Lprint "              Line #           Label"
  129.     Lprint "**********************************************"
  130.     For X=0 To Labcnt-1
  131.       Print At(50,10);X;
  132.       Lprint ,Label(X),Label$(X)
  133.     Next X
  134.   Endif
  135. Return
  136. Procedure Prprocs
  137.   If Proccnt
  138.     Cls
  139.     Print At(1,10);"Printing Procedures...";
  140.     Lprint
  141.     Lprint "**********************************************"
  142.     Lprint "              Line #           Procedures"
  143.     Lprint "**********************************************"
  144.     For X=0 To Proccnt-1
  145.       Print At(50,10);X;
  146.       Lprint ,Procs(X),Procs$(X)
  147.     Next X
  148.   Endif
  149. Return
  150. Procedure Prfuncs
  151.   If Funcscnt
  152.     Cls
  153.     Print At(1,10);"Printing Functions...";
  154.     Lprint
  155.     Lprint "**********************************************"
  156.     Lprint "              Line #           Functions"
  157.     Lprint "**********************************************"
  158.     For X=0 To Funcscnt-1
  159.       Print At(50,10);X;
  160.       Lprint ,Funcs(X),Funcs$(X)
  161.     Next X
  162.   Endif
  163. Return
  164. Procedure Listpgm
  165.   Cls
  166.   Print At(1,10);"Printing the program...";
  167.   Lprint
  168.   Lprint "============================================="
  169.   Lprint "              Program Lines"
  170.   Lprint "Line#  |                Program line"
  171.   Lprint "============================================="
  172.   For X=0 To Numlines%
  173.     Lprint X;Tab(8);A$(X)
  174.   Next X
  175. Return
  176.